package com.jizhang.base.model;

import com.jizhang.base.constant.ErrorMessaageEnum;
import lombok.AllArgsConstructor;
import lombok.Data;

/*
捕获异常
 */
@Data
@AllArgsConstructor
public class BusinessException extends RuntimeException {


    private int code;
    private String message;
    private Object data;

    public BusinessException(){}
    public BusinessException(ErrorMessaageEnum messageEnum){
        this.code=messageEnum.getCode();
        this.message=messageEnum.getMessage();
    }
    public BusinessException(int code, String message){
        this.code=code;
        this.message=message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}
